Object oriented programming (OOP) is the preferred environment for building user-friendly, intelligent computer software. Key elements of OOP are data encapsulation, inheritance and polymorphism. These elements may be used to generate a graphical user interface (GUI), typically characterized by a windowing environment having icons, mouse cursors and menus. While these three key elements are common to OOP languages, most OOP languages implement the three key elements differently.
Examples of OOP languages are Smalltalk, Object Pascal and C++. Smalltalk is actually more than a language; it might more accurately be characterized as a programming environment. Smalltalk was developed in the Learning Research Group at Xerox's Palo Alto Research Center (PARC) in the early 1970s. In Smalltalk, a message is sent to an object to evaluate the object itself. Messages perform a task similar to that of function calls in conventional programming languages. The programmer does not need to be concerned with the type of data; rather, the programmer need only be concerned with creating the right order of a message and using the right message. Object Pascal is the language used for Apple's Machintosh.RTM. computers. Apple developed Object Pascal with the collaboration of Niklaus Wirth, the designer of Pascal. C++ was developed by Bjarne Stroustrup at the AT&T Bell Laboratories in 1983 as an extension of C. The key concept of C++ is a class, which is a user-defined type. Classes provide object oriented programming features. C++ modules are compatible with C modules and can be linked freely so that existing C libraries may be used with C++ programs. The most widely used object based and object oriented programming languages trace their heritage to Simula developed in the 1960s by O. J. Dahl, B. Myhrhaug and K. Nygard of Norway. Further information on the subject of OOP may be had by reference to Object Oriented Design with Applications by Grady Booch, The Benjimin/Cummings Publishing Co., Inc., Readwood City, Calif. (1991).
The complete process of running a computer program involves translation of the source code written by the
programmer to machine executable form, referred to as object code, and then execution of the object code. The process of translation is performed by an interpreter or a compiler. In the case of an interpreter, the translation is made at the time the program is run, whereas in the case of a compiler, the translation is made and stored as object code prior to running the program. That is, in the usual compile and execute system, the two phases of translation and execution are separate, the compilation being done only once. In an interpretive system, such as the Smalltalk interpreter, the two phases are performed in sequence. An interpreter is required for Smalltalk since the nature of that programming environment does not permit designation of specific registers or address space until an object is implemented.
A compiler comprises three parts; the lexical analyzer, the syntax analyzer, and the code generator. The input to the lexical analyzer is a sequence of characters representing a high-level language program. The lexical analyzer divides this sequence into a sequence of tokens that are input to the syntax analyzer. The syntax analyzer divides the tokens into instructions and, using a database of grammatical rules, determines whether or not each instruction is grammatically correct. If not, error messages are produced. If correct, the instruction is decomposed into a sequence of basic instructions that are transferred to the code generator to produce a low-level language. The code generator is itself typically divided into three parts; intermediate code generation, code optimization, and code generation. Basically, the code generator accepts the output from the syntax analyzer and generates the machine language code.
To aid in the development of software, incremental compilers have been developed in which the compiler generates code for a statement or a group of statements as received, independent of the code generated later for other statements, in a batch processing operation. The advantage of incremental compiling is that only the code affected by a change is compiled. This action results in much faster turn-around times for compiling and debugging code.
Optimizing compilers produce highly optimized object code which, in many cases, makes debugging at the source level more difficult than with a non-optimizing compiler. The problem lies in the fact that although a routine will be compiled to give the proper answer, the exact way it computes that answer may be significantly different from that described in the source code. Some things that the optimizing compiler may do include eliminating code or variables known not to affect the final result, moving invariant code out of loops, combining common code, reusing registers allocated to variables when the variable is no longer needed, etc. Thus, mapping from source to object code and vice versa can be difficult given some of these optimizations. Inspecting the values of variables can be difficult since the value of the variable may not always be available at any location within the routine. Modifying the values of variables in optimized code is especially difficult, if not impossible. Unless specifically declared as volatile, the compiler "remembers" values assigned to variables and may use the "known" value later in the code without rereading the variable. A change in that value could, therefore, produce erroneous program results.
While there have been many advances in the art of computer program building, testing and developing, the known software development tools still place a substantial burden on the programmer, often requiring insightful intuition. In addition, traditional batch oriented programming systems provide for very long edit-compile-test cycles which is very disruptive to the creative act of programming.
Once compilation is completed in conventional programming systems, the application must still be linked and loaded. A program called a linker makes a single program from several files of relocatable machine code. These files may have been the result of several compilations. The program is then loaded, consisting of: taking relocatable machine code, altering the relocatable addresses and placing the altered instructions and data in memory at the proper locations.